<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<body class="hold-transition skin-blue sidebar-mini">

<section class="content-header">
    <h1>提报计划确认</h1>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm" onsubmit="return false;">
                        <div class="row">
                            <div class="form-inline">
                                <div class="form-group">
                                    <label for="query-proCode">项目编号</label>
                                    <input id="query-proCode" type="text" name="proCode" class="form-control"
                                           placeholder="请输入项目编号">
                                </div>
                                <div class="form-group">
                                    <label for="query-proName">项目名称</label>
                                    <input id="query-proName" type="text" name="proName" class="form-control"
                                           placeholder="请输入项目名称">
                                </div>
                                <div class="form-group">
                                    <label for="query-malType">类型</label>
                                    <select id="query-malType" class="form-control" name="malType">
                                        <option value="" selected>请选择</option>
                                        <option th:each="type : ${malTypes}" th:value="${type.name}"
                                                th:text="${type.name}"></option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="query-part">部分</label>
                                    <input id="query-part" type="text" name="part" class="form-control"
                                           placeholder="请输入部分">
                                </div>
                                <div class="form-group">
                                    <label for="query-status">状态</label>
                                    <select id="query-status" class="form-control" name="status">
                                        <!--<option value="">请选择</option>-->
                                        <option value="5" selected>未确认</option>
                                        <option value="6">已确认</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="query-postName">提报人</label>
                                    <input id="query-postName" type="text" name="postName" class="form-control"
                                           placeholder="请输入提报人">
                                </div>
                                <div class="form-group">
                                    <label for="query-sheetType">提报类型</label>
                                    <select id="query-sheetType" class="form-control" name="sheetType">
                                        <option value="">请选择</option>
                                        <option value="1">提报单</option>
                                        <option value="2">变更单</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="query-startTime">提报日期</label>
                                    <input id="query-startTime" type="text" class="form-control datepicker" name="startTime"
                                           readonly="readonly"/>
                                    <label for="query-endTime"> 至 </label>
                                    <input id="query-endTime" type="text" class="form-control datepicker" name="endTime"
                                           readonly="readonly"/>
                                </div>
                                <button type="button" class="btn btn-success" id="btn-search"
                                        onclick="js.table.search(table)">
                                    <span class="Bold">搜索</span>
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="box-body">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">

    // let table, typeName = ['', '外购件', '外协件', '原材料'], sheetType = ['','提报单','变更单'];
    let table, typeName = ['', '外购件'], sheetType = ['','提报单','变更单'];

    $(function () {

        /** 加载列表 */
        table = js.table.init({
            url: ctx + "report/confirm/list",
            showExport: false,
            columns: [
                {title: '序号', field: 'id', width: '50px',
                    formatter: function (value, row, index) {
                        return index + 1;
                    }
                },
                {title: "分类", field: 'reportType',
                    formatter: function (value) {
                        /*if (value === 1) {
                            return '<span class="badge label-success">外购件</span>';
                        } else if (value === 2) {
                            return '<span class="badge label-warning">外协件</span>';
                        } else if (value === 3) {
                            return '<span class="badge label-inverse">原材料</span>';
                        }*/
                        return typeName[value];
                    }
                },
                {title: "项目编号", field: 'proCode'},
                {title: "项目名称", field: 'proName'},
                {title: "项目数量", field: 'proNum'},
                {title: "类型", field: 'malType'},
                {title: "部分", field: 'part'},
                {title: "提报类型", field: 'sheetType',
                    formatter: function (value) {
                        if (value === 1) {
                            return '<span>提报单</span>';
                        } else if (value === 2) {
                            return '<span>变更单</span>';
                        }
                        // return sheetType[value];
                    }
                },
                {title: "状态", field: 'status',
                    formatter: function (value) {
                        if (value === 5) {
                            return '<span class="badge label-warning">未确认</span>';
                        } else if (value === 6) {
                            return '<span class="badge label-success">已确认</span>';
                        }
                    }
                },
                {title: "提报人", field: 'postName'},
                {title: "提报日期", field: 'createTime'},
                {
                    title: "操作",
                    // width: '250',
                    formatter: function (value, row) {
                        let actions = [];
                        actions.push('<a class="btn btn-info btn-xs" href="' + ctx + 'report/confirm/info/' + row.id + '" > 查看</a>');
                        return actions.join('');
                    }
                }
            ]
        });

    });
</script>
</body>
</html>
